package com.google.code.coma.rmi.storage;

import com.google.code.coma.rmi.EntrySelector;
import com.google.code.coma.rmi.ObserveCallback;
import com.google.code.coma.rmi.RMICallback;
import com.sun.corba.se.spi.activation.Server;

import java.io.Serializable;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.List;

/**
 * @author Bernhard Nickel, e0925384@student.tuwien.ac.at
 * @author Dominik Strasser, dominikstr@gmail.com
 */
public interface StorageService<T extends Serializable> extends Remote {
	/**
	 * Adds an entry to this storage
	 *
	 * @param entry the entry which should be added
	 * @throws RemoteException technical exception according to the RMI specification
	 */
	public void add(T entry) throws RemoteException;

    public List<T> getSnapshot(EntrySelector<T> selector) throws RemoteException;

    public void update(T entry) throws RemoteException;

	/**
	 *
	 * @param clazz
	 * @param selector
	 * @param callback
	 * @throws RemoteException technical exception according to the RMI specification
	 */
	public void registerCallback(EntrySelector<T> selector, RMICallback<T> callback) throws RemoteException;

    public List<T> take(EntrySelector<T> selector) throws RemoteException;

	/**
	 *
	 * @param clazz
	 * @param observeCallback
	 * @param changeActions
	 * @throws RemoteException technical exception according to the RMI specification
	 */
	public void registerObserveCallback(ObserveCallback<T> observeCallback, ObserveCallback.ChangeAction... changeActions) throws RemoteException;
}
